// const app = require('express')()

//导入uuid模块
const uuid = require('node-uuid')

//导入数据库操作模块
const db = require("../../db/index")

// 格式化时间
var moment = require('moment')

/**
 * 获取事件列表
 * @param {*} req 
 * @param {*} res 
 */
exports.getEventList = (req, res) => {
    // console.log('获取事件列表' + req.ip)
    const type = req.query.type
    const sql = `SELECT * FROM xks_event WHERE type = ?`;
    db.query(sql, type, (err, results) => {
        if (err) {
            return res.send({
                code: 505,
                msg: '获取失败，发送了错误' + err.message,
                data: {}
            })
        }
        return res.send({
            code: 200,
            msg: '成功',
            data: {
                list: results
            }
        })
    })
}

